package org.javaboy.demo;

import org.javaboy.demo.config.JavaConfig;
import org.javaboy.demo.model.Book;
import org.javaboy.demo.model.User;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Demo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(JavaConfig.class);
        User user = ctx.getBean("user2", User.class);
        System.out.println("user = " + user);
        Book book = ctx.getBean(Book.class);
        System.out.println("user.getBook()==book = " + (user.getBook() == book));
    }
}
